extern crate deadpool_redis; //redis连接池
extern crate futures;//异步
extern crate env_logger;//日志
extern crate urlencoding;//URI编码
extern crate reqwest ;//https 客户端访问
#[macro_use]
extern crate lazy_static;//静态缓存
extern crate serde_json;//json处理
use actix_web::{middleware::Logger, App, HttpServer};
mod rediswrapper;//redis操作封装
mod webservice; //web服务 //redis连接池封装
#[actix_web::main]
async fn main() -> std::io::Result<()> {
    // access logs are printed with the INFO level so ensure it is enabled by default
    //访问日志
    env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));

    HttpServer::new(|| {
        App::new()
            .wrap(Logger::default()) //访问日志
            //cas过滤器
            .wrap(webservice::cas::middleware::CasAuth)
            //路由配置
            .configure(webservice::routes)
            

    })
    .bind("0.0.0.0:8080")? //暴露端口
    .run()
    .await
}
